package com.you.concurrent.map;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

public class ConcurrentHashMapDemo {

    static ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();

    static HashMap hashMap = new HashMap();

    public static void main(String[] args) {
        long startTime = System.currentTimeMillis();
        for (int i = 0; i < 1; i++) {
            //new Thread(() -> {
            for (int index = 0; index < 1000000; index++) {
                concurrentHashMap.put(index, index);
                //hashMap.put(index,index);
            }
            //}).start();
        }
        concurrentHashMap.get(100);
        System.out.println("-----耗时：" + (System.currentTimeMillis() - startTime));
    }

}
